package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseListResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.groupalternative.GroupAlternativeAddReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.groupalternative.GroupAlternativeListReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.groupalternative.GroupAlternativeListResVo;
import com.zmj.sy.mom.srv.aps.service.GroupAlternativeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "备选工作组")
@RestController
@RequestMapping("/groupAlternative")
public class GroupAlternativeController {

    private final GroupAlternativeService groupAlternativeService;

    @ApiOperation("根据当前工作组ID，列出所有的备用工作组")
    @GetMapping("/list")
    public BaseListResVo<GroupAlternativeListResVo> list(GroupAlternativeListReqVo reqVo) {
        return groupAlternativeService.list(reqVo);
    }

    @ApiOperation("给某个工作组移入选工作组")
    @PostMapping("/add")
    public BaseResVo add(@RequestBody GroupAlternativeAddReqVo reqVo) {
        groupAlternativeService.add(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("移除备选工作组")
    @PostMapping("/delete")
    public BaseResVo delete(@RequestBody BaseIdReqVo reqVo) {
        groupAlternativeService.delete(reqVo);
        return BaseResVo.ok();
    }

}
